package com.huatai.bi.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

@TableName("tb_table")
@ApiModel(value = "数据源表",description = "数据源表")
@Data
public class TableEntity {
	@TableId(value = "id",type = IdType.ASSIGN_ID)
	@ApiModelProperty("主键")
	private Long id;

	@TableField(value = "datasource_id")
	@ApiModelProperty(value = "数据源ID")
	private Long datasourceId;

	@TableField(value = "table_catalog")
	@ApiModelProperty(value = "数据库名称")
	private String tableCatalog;

	@TableField(value = "table_schema")
	@ApiModelProperty(value = "schema")
	private String tableSchema;

	@TableField(value = "table_name")
	@ApiModelProperty(value = "表名")
	private String tableName;

	@TableField(value = "table_comment")
	@ApiModelProperty(value = "表注释")
	private String tableComment;

	@TableField(value = "column_num")
	@ApiModelProperty(value = "字段数")
	private Integer columnNum;

	@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
	@TableField(value = "table_create_time")
	@ApiModelProperty(value = "表创建时间",hidden = true)
	private Date tableCreateTime;

	@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
	@TableField(value = "create_time",fill = FieldFill.INSERT)
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
	@ApiModelProperty(value = "创建时间",hidden = true)
	private Date createTime;

	@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
	@TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE)
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
	@ApiModelProperty(value = "修改时间",hidden = true)
	private Date updateTime;

	@TableField(exist = false)
	private String datasourceName;

	@TableField(exist = false)
	private boolean isSelect;

	@TableField(exist = false)
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
	@ApiModelProperty(value = "同步时间",hidden = true)
	private Date synTime;

	@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
	@TableField(value = "is_deleted")
	@ApiModelProperty(value = "删除状态",hidden = true)
	@TableLogic
	private boolean isDeleted;
}
